export default {
    tooltip: {
        trigger: 'axis',
        axisPointer: { type: 'shadow' },
    },
    // 图表位置
    grid: {
        top: '0',
        left: '3%',
        right: '4%',
        bottom: '0%',
        containLabel: true,
    },
    xAxis: {
        type: 'value',
        axisLine: { show: false },
        axisTick: { show: false },
        // 不显示X轴刻度线和数字
        splitLine: { show: false },
        axisLabel: { show: false },
    },
    yAxis: {
        type: 'category',
        data: ['怀化市', '永州市', '郴州市', '邵阳市', '衡阳市', '常德市', '湘西州', '株洲市', '益阳市'],
        // 升序
        inverse: true,
        splitLine: { show: false },
        axisLine: {
            show: true,
            lineStyle: { color: '#6E7079' },
        },
        axisTick: {
            show: true,
            lineStyle: { color: '#6E7079' },
        },
        axisLabel: {
            formatter(value, index) {
                if (index < 3) {
                    return `{top${index + 1}|No.${index + 1}}   {title|${value}}`;
                }
                return `{topqt|No.${index + 1}}   {title|${value}}`;
            },
            rich: {
                title: { color: '#C2E5FF' },
                top1: { color: '#EB5E12' },
                top2: { color: '#FFC000' },
                top3: { color: '#1FE7E7' },
                topqt: { color: '#ECFEFE' },
            },
        },
        // key和图间距
        offset: 10,
        // 动画部分
        animationDuration: 300,
        animationDurationUpdate: 300,
        // key文字大小
        nameTextStyle: {
            fontSize: 5,
            textStyle: { color: '#08D6F7' },
        },
    },
    series: [
        {
            // 柱状图自动排序，排序自动让Y轴名字跟着数据动
            realtimeSort: true,
            name: '数量',
            type: 'bar',
            data: [730, 801, 924, 1259, 1600, 411, 1090, 888, 466],
            barWidth: 15,
            barGap: 10,
            smooth: true,
            valueAnimation: true,
            label: {
                normal: {
                    show: true,
                    position: 'right',
                    valueAnimation: true,
                    offset: [5, -2],
                    textStyle: {
                        color: '#fff',
                        fontSize: 13,
                    },
                },
            },
            itemStyle: {
                emphasis: { barBorderRadius: 0 },
                // 颜色样式部分
                normal: {
                    barBorderRadius: 0,
                    // eslint-disable-next-line no-undef
                    color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                        { offset: 0, color: 'rgba(8, 214, 247, 0)' },
                        { offset: 1, color: '#08D6F7' },
                    ]),
                },
            },
        },
    ],
    // 动画部分

  animationDuration: 0,
  animationDurationUpdate: 3000,
  animationEasing: 'linear',
  animationEasingUpdate: 'linear'
}
